create database LeaveManagerSystem
go
use LeaveManagerSystem
go

create table Author
(
	AuthorID int identity,
	AuthorName nvarchar(10) not null,
	constraint PK_Author primary key (AuthorID) 
)

go
create table [User]
(
	UserName nvarchar(30),
	Pass_Word nvarchar(10) not null,
	AuthorID int not null,
	FullName nvarchar(30) not null,
	Gender bit not null,
	[Status] bit not null,
	constraint PK_User primary key (UserName),
	constraint FK_User_Author foreign key(AuthorID) references Author(AuthorID)
)
go


create table Department
(
	DepartmentID nvarchar(10),
	DepartmentName nvarchar(30) not null,
	[status] bit not null,
	constraint PK_Department primary key (DepartmentID),
	
)
go
create table Employee
(
	EmployeeID int identity,
	Employee_Name nvarchar(30) not null,
	DepartmentID nvarchar(10) not null,
	AuthorID int not null,
	Gender bit not null,
	[Address] nvarchar(30) not null,
	Phone int not null,
	[Status] bit not null,
	constraint PK_Employee primary key (EmployeeID),
	constraint FK_Employee_Author foreign key (AuthorID) references  Author(AuthorID),
	constraint FK_Department_Employee foreign key (DepartmentID) references Department(DepartmentID)
)


go
create table [Order]
(
	OrderID int identity,
	EmployeeID int not null,
	StartDate Date not null,
	EndDate Date not null,
	Reasons nvarchar(100),
	[Status] int not null,
	DateBack_Fact Date,
	Reasosn_delay nvarchar(100),
	constraint PK_Order primary key(OrderID),
	constraint FK_Order_Employee foreign key (EmployeeID) references Employee(EmployeeID)
	)




